<?php
/**
 * This file is part from Ewuroweb Shop
 *
 * @package 
 * @author Ivan I. Atanasov <i.atanasov@viscomp.bg>
 */

require_once 'Testing/Selenium.php';

/**
 * Selenium adapter
 * 
 * @author Ivan I. Atanasov <i.atanasov@viscomp.bg>
 *
 */
class VisSelenium extends Testing_Selenium {
    
    /**
     * Timeout to wait a page to load
     * 
     * There is a property parent::$timeout that have the same idea,
     * but it's private and it has not any methods for access it.
     * 
     * @var int
     */
    protected $_iTimeout = 50000;
    
    /**
     * Default Constructor
     * 
     * @param $browser
     * @param $browserUrl
     * @param $host
     * @param $port
     * @param $timeout
     * @return unknown_type
     */
    function __construct($browser, $browserUrl, $host = 'localhost', $port = 4444, $timeout = 30000) {
        parent::__construct($browser, $browserUrl, $host = 'localhost', $port = 4444, $timeout = 30000);
        
        $this->_iTimeout = $timeout;
    }
    //==============================================================================
    
    /**
     * (non-PHPdoc)
     * @see VisTesting/library/Testing/Testing_Selenium#setTimeout($timeout)
     */
    function setTimeout($iTimeout) {
        parent::setTimeout($iTimeout);
        $this->_iTimeout = $iTimeout; 
    }
    //==============================================================================
    
    /**
     * 
     * @param $target
     * @return unknown_type
     */
    function clickAndWait($target) {
        $this->click($target);
        $this->waitForPageToLoad($this->_iTimeout);
    }
    //==============================================================================
    
}
